<?php
$dbh= new PDO('mysql:host=127.0.0.1;dbname=1705phpa', 'root', 'root');

$l_name=$_GET['l_name'];
$l_pwd=$_GET['l_pwd'];

session_start();

$sql="select * from login where l_name='$l_name' and l_pwd='$l_pwd'";
$res=$dbh->query($sql);
$arr=$res->fetch(2);
if($arr)
{
    echo ("<script>alert('用户名正确');location.href='./add.html'</script>");
}
else
{
    echo ("<script>alert('用户名错误');location.href='./login.html'</script>");
}

?>